-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Make unknown instead of any the default scalar type
#10566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make unknown instead of any the default scalar type
#10566
Conversation
🦋 Changeset detectedLatest commit: b87e885 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-codegen/cli |
6.1.1-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/introspection |
5.0.1-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/visitor-plugin-common |
7.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-document-nodes |
5.0.8-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/gql-tag-operations |
5.1.3-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-operations |
6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript-resolvers |
6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typed-document-node |
6.1.6-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/typescript |
6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/client-preset |
6.0.0-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
@graphql-codegen/graphql-modules-preset |
5.1.3-alpha-20260113141826-b87e885fd6c88d2baffa14fd9f42f0f1b5a4dfcb |
npm ↗︎ unpkg ↗︎ |
1f47eb4 to
ffb3b8f
Compare
| } | ||
|
|
||
| typePart = usedInputType.tsType; // If the schema is correct, when reversing typeNodes, the first node would be `NamedType`, which means we can safely set it as the base for typePart | ||
| if (usedInputType.tsType !== 'any' && !typeNode.isNonNullable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When unknown and any is used, | null | undefined is not required.
However, the logic could be complex, so I'll bring back this condition and tests in another PR.
packages/plugins/typescript/operations/src/ts-operation-variables-to-object.ts
Outdated
Show resolved
Hide resolved
70dd961 to
033594f
Compare
Description
anydisables any typechecks and feedback from the TypeScript language server.unknownforces the user to check at runtime, so it's better thanany.This PR:
unknownfor the reasons above.undefinedvalues if it is nullableRelated #10496
Type of change